#!/usr/bin/env python
# encoding: utf-8
import pika
import time

credentials = pika.PlainCredentials("guest", "guest")
conn_params = pika.ConnectionParameters("localhost",credentials=credentials)
conn_broker = pika.BlockingConnection(conn_params)
channel = conn_broker.channel()

channel.exchange_declare(exchange="exchange15", 
                         exchange_type="direct",
                         passive=False,
                         durable=False,
                         auto_delete=False)

channel.queue_declare(queue="pull_queue",auto_delete=True) 

channel.queue_bind(queue="pull_queue", 
                   exchange="exchange15",
                   routing_key="hola")

channel.basic_publish(body="quit",
                      exchange="exchange15",
                      routing_key="hola")

method,properties,body = channel.basic_get(queue="pull_queue")
channel.basic_ack(delivery_tag=method.delivery_tag)
print body

